import http from '@/utils/request.js';

// 申请配件发起
export const partsStartProcess = (data) => {
	// return http.post('/blade-flow/parts/start-process',data,true);
	return http.request({
		url: '/blade-flow/parts/start-process',
		method: 'post',
		data,
		textJson: true,
	});
};
// 申请配件发起-新
export const partsStart = (data) => {
	// return http.post('/maintain/parts/work/partsSave',data,true);
	return http.request({
		url: '/maintain/parts/work/partsSave',
		method: 'post',
		data,
		textJson: true,
	});
};
// 退回后重新提交-申请配件发起-新
export const partsResubmit = (data) => {
	return http.request({
		url: '/maintain/parts/work/resubmit',
		method: 'post',
		data,
		textJson: true,
	});
};

// 维修申请配件列表
export const partsWorkorderList = (data) => {
	// return http.get('/maintain/parts/work/elevator/page',data);
	return http.request({
		url: '/maintain/parts/work/elevator/page',
		method: 'get',
		data,
	});
};
// 我的申请配件列表
export const partsMyList = (data) => {
	// return http.get('/maintain/parts/work/user/page',data);
	return http.request({
		url: '/maintain/parts/work/user/page',
		method: 'get',
		data,
	});
};
// 我的申请配件列表-新
export const partsNewMyList = (data) => {
	// return http.get('/maintain/parts/work/apply',data);
	return http.request({
		url: '/maintain/parts/work/apply',
		method: 'get',
		data,
	});
};

// 我的审批配件列表
export const partsMyAuditList = (data) => {
	// return http.get('/maintain/parts/work/audit/page',data);
	return http.request({
		url: '/maintain/parts/work/audit/page',
		method: 'get',
		data,
	});
};

// 获取配件更换详情
export const partsMyAuditDetail = (data) => {
	// return http.get('/maintain/parts/work/detail',data);
	return http.request({
		url: '/maintain/parts/work/detail',
		method: 'get',
		data,
	});
};
// 修改配件信息
export const partsMyAuditDetailWork = (data) => {
	// return http.put('/maintain/parts/work',data);
	return http.request({
		url: '/maintain/parts/work',
		method: 'put',
		data,
		textJson: true,
	});
};

// 配件申请获取公司地址
export const partsCompanyAddress = (data) => {
	// return http.get('/repair/partaddress/detail',data);
	return http.request({
		url: '/repair/partaddress/detail',
		method: 'get',
		data,
	});
};

// 获取省市区
export const getRegionTree = (data) => {
	// return http.get('/blade-system/region/getRegionTree',data);
	return http.request({
		url: '/blade-system/region/getRegionTree',
		method: 'get',
		data,
	});
};

// 配件根据类目查询属性信息
export const getSkuTemplate = (data) => {
	return http.request({
		url: '/repair/parts/shop/get-attr-list',
		method: 'get',
		data,
	});
};
// 配件sku详情
export const getSkuDetail = (data) => {
	return http.request({
		url: '/repair/parts/shop/sku-detail',
		method: 'get',
		data,
	});
};
// 配件sku列表
export const getSkuList = (data) => {
	return http.request({
		url: '/repair/elevator/parts/structure/relation/sku/list',
		method: 'get',
		data,
	});
};
// 配件sku下拉选项
export const getSkuOptions = (data) => {
	return http.request({
		url: '/repair/parts/shop/sku-detail-list',
		method: 'get',
		data,
	});
};
// 新增单位
export const userUnit = (data) => {
	return http.request({
		url: '/repair/userunit/save',
		method: 'post',
		data,
		textJson: true,
	});
};
// 获取单位列表

export const userUnitList = (params) => {
	return http.request({
		url: '/repair/parts/shop/get-unit-list',
		method: 'get',
		params,
	});
};

// 获取ERP销售信息-全部
export const getERPDetail = (data) => {
	return http.request({
		url: '/repair/partner/cloud/search/order',
		method: 'get',
		data,
	});
};

// 获取ERP销售信息
export const getERPDetailMain = (data) => {
	return http.request({
		url: '/repair/partner/cloud/search/order/main',
		method: 'get',
		data,
	});
};

// 获取ERP销售信息-发货明细
export const getERPDetailSub = (data) => {
	return http.request({
		url: '/repair/partner/cloud/search/order/sub',
		method: 'get',
		data,
	});
};